<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>未付款</title>
    <link rel="stylesheet" href="tubiao.css">
    <link rel="stylesheet" href="../../../layui/css/layui.css">
    <script src="../../../layui/layui.js"></script>
</head>
<body>
<div class="dingbu">
    <div class="dingbu_dashuju"><label></label>参与检测未付款人员：</div>
</div>
<!--最外部数据表格容器-->
<div style="margin-left: 15%;margin-top: 5%">
    <table id="demo1" lay-filter="test"></table>
</div>

<script>
    function RiQi(sj) {
        var now = new Date(sj * 1000);
        var year = now.getFullYear();
        var month = now.getMonth() + 1;
        var date = now.getDate();
        var hour = now.getHours();
        var minute = now.getMinutes();
        var second = now.getSeconds();
        if (month < 10) {
            month = '0' + month;
        }
        if (date < 10) {
            date = '0' + date;
        }
        if (hour < 10) {
            hour = '0' + hour;
        }
        if (minute < 10) {
            minute = '0' + minute;
        }
        if (second < 10) {
            second = '0' + second;
        }
        return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;

    }
    layui.use('table', function () {
        var table = layui.table;


        // 正则表达式获取设备编号
        function getQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return decodeURI(r[2]);
            return null;
        }

        var param = getQueryString('_ijt');
        // 打印对应的设备编号
        // console.log(param);
        //第一个实例
        table.render({
            elem: '#demo1'
            , height: 500
            , width: 1058
            , url: '/api/getUpidInformationList' //数据接口
            ,where:{sbno:param}
            , page: true //开启分页
            , limits: '[10,20,30,40]'
            , loading: 'true'
            , cols: [[ //表头
                {field: 'phone', title: '手机号码', width: 150, fixed: 'left'}
                , {field: 'age', title: '年龄', width: 100}
                , {field: 'gender', title: '性别', width: 100, templet: '#titleTpl2'}
                , {field: 'paytype', title: '付款方式', width: 100, templet: '#titleTpl3'}
                , {field: 'status', title: '是否付款', width: 100, templet: '#titleTpl4'}
                , {
                    field: 'addtime', title: '检测时间', width: 250,
                    templet: function (d) {
                        var timen = RiQi(d.addtime.time / 1000);
                        return timen;
                    }
                }
                , {field: 'pdfurl', title: '查看报告', width: 250, templet: '#titleTpl'}

            ]],
        });
    });
</script>
<script type="text/html" id="titleTpl">
    <a href="{{d.pdfurl}}" target="_blank" class="layui-table-link">查看报告</a>
</script>
<script type="text/html" id="titleTpl2">
    {{# if(d.gender=='0'){ }}
    男
    {{# } else{ }}
    女
    {{# } }}
</script>
<script type="text/html" id="titleTpl3">
    {{# if(d.paytype=='0'){ }}
    未支付
    {{# } else if(d.paytype=='1'){ }}
    现金支付
    {{# }else{}}
    票券支付
    {{# } }}
</script>
<script type="text/html" id="titleTpl4">
    {{# if(d.status=='0'){ }}
    未支付
    {{# } else if(d.status=='1'){ }}
    支付成功
    {{# }else{}}
    支付失败
    {{# } }}
</script>
</body>
</html>